package com.magic.gre.mvp.presenter;

import com.google.gson.reflect.TypeToken;
import com.magic.gre.entity.ActivityBean;
import com.magic.gre.entity.base.BaseObjectModel;
import com.magic.gre.mvp.contract.ActivityDetailsContract;
import com.magic.gre.mvp.model.ActivityDetailsModelImpl;
import com.noname.lib_base_java.mvp.BasePresenterImpl;
import com.noname.lib_base_java.util.L;

/**
 * Author: Lmoumou
 * Date: 2019-01-10 09:50
 * 文件名: ActivityDetailsPresenterImpl
 * 描述:
 */
public class ActivityDetailsPresenterImpl extends BasePresenterImpl<ActivityDetailsContract.View, ActivityDetailsContract.Model>
        implements ActivityDetailsContract.Presenter {
    public ActivityDetailsPresenterImpl(ActivityDetailsContract.View view) {
        super(view);
    }

    @Override
    protected ActivityDetailsContract.Model creatModel() {
        return new ActivityDetailsModelImpl();
    }

//    @Override
//    public void pActDetails(String activityId) {
//
//        mModel.mActDetails(new CommonObserver<BaseObjectModel<ActivityBean>>(new TypeToken<BaseObjectModel<ActivityBean>>(){}.getType()) {
//            @Override
//            protected void onSuccess(BaseObjectModel<ActivityBean> activityBeanBaseObjectModel) {
//                mView.vActDetails(activityBeanBaseObjectModel.body);
//            }
//
//            @Override
//            public void onError(int status, String msg) {
//                mView.doPrompt(msg);
//            }
//        }, activityId);
//    }

    @Override
    public void pActApply(String activityId, String wechatNum) {
        mModel.mActApply(new CommonObserver<BaseObjectModel>(new TypeToken<BaseObjectModel>(){}.getType()) {
            @Override
            protected void onSuccess(BaseObjectModel baseObjectModel) {
                mView.vActApply();
            }

            @Override
            public void onError(int status, String msg) {
                mView.doPrompt(msg);
            }
        }, activityId, wechatNum);
    }
}
